package com.atguigu.gmall.weball.controller;

import com.atguigu.gmall.product.vo.CategoryTreeVo;
import com.atguigu.gamll.feign.product.CategoryFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lhh
 * @ClassName IndexController
 * @date 2022 2022/12/3
 */
@Controller
public class IndexController {

    @Resource
    CategoryFeignClient categoryFeignClient;

    @GetMapping({"/","/index.html"})
    public String toIndex(Model model){
        List<CategoryTreeVo>  categoryTreeVos=categoryFeignClient.getCategoryTree().getData();
        model.addAttribute("list",categoryTreeVos);
        return "index/index";
    }

}
